package com.evan.common.core.constant;

public enum ModuleTypeEnum {
    DEFAULT(1, "全部"),COURSE(2, "闯关模式"),EXAM(3, "学员考试"),MATERIAL(4, "资料查看"),EVLUATE(5, "教学评估");

    private int code;
    private String name;

    ModuleTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ModuleTypeEnum getByCode(int code) {
        for (ModuleTypeEnum type : ModuleTypeEnum.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }

    public static ModuleTypeEnum getByName(String name) {
        for (ModuleTypeEnum type : ModuleTypeEnum.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
